package com.example.teaching_server.entity;

import jakarta.persistence.*;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Size;
import lombok.*;

/**
 * 资源类型实体类
 *
 * @author Teaching Server
 * @since 1.0.0
 */
@Getter
@Setter
@ToString
@EqualsAndHashCode(of = "code")
@Entity
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Table(name = "resource_types")
public class ResourceType {

    /**
     * 资源类型代码
     */
    @Id
    @NotBlank(message = "资源类型代码不能为空")
    @Size(max = 20, message = "资源类型代码长度不能超过20个字符")
    @Column(name = "code", length = 20)
    private String code;

    /**
     * 资源类型标签
     */
    @NotBlank(message = "资源类型标签不能为空")
    @Size(max = 20, message = "资源类型标签长度不能超过20个字符")
    @Column(nullable = false, length = 20)
    private String label;

    /**
     * 资源类型图标
     */
    @Size(max = 50, message = "资源类型图标长度不能超过50个字符")
    @Column(length = 50)
    private String icon;
}
